from Devices.Chiot.BsDevs.ComDev.ComDevParser import ComDevParser

class SosParser(ComDevParser):
    def ParseHeartbeat(msgValue, fullStatus):
        if not "stateValue" in msgValue:
            return True
        stateValue = msgValue["stateValue"]

        ret, value = SosParser.GetIntProperty(stateValue, "sos", "status")
        if ret:
            fullStatus.sensorStatus = value

        ret, value = SosParser.GetIntProperty(stateValue, "sos", "alarmTime")
        if ret:
            fullStatus.sensorStatusChangeTime = value
        return True
